class Volume < ActiveRecord::Base
  has_many :stories
  
  def after_create
    if self.stories.empty?
      self.stories << Story.default
    end
  end
  
  def after_save
    #XmlFile.write_file_from_db
  end
  
  def to_hash #for init only
    {
      :stories=>stories.collect{|s|s.to_hash},
      :attributes=>self.attributes,
      :id=>id
    }
  end
end
